package com.gw.yunke.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Pattern;

public class MiscUtils {

    public static boolean isEmpty(String s){
        return s == null || s.equals("");
    }

    public static boolean isNull(Object o){
        return o == null;
    }

//    public static void main(String args[]){
//        String s = "";
//        System.out.println(s .equals( ""));
//    }

    public static boolean regexTime(String data){
        String regex = "";
        return false;
    }

    /**
     * 将 HH:mm:ss格式的时间转成对应的秒数
     * @param date
     * @return
     */
    public static Long timeTOSecode(Date date){
        SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
        String time = format.format(date);
        String hms[] = time.split(":");
        long h = Long.parseLong(hms[0]) * 3600;
        long m = Long.parseLong(hms[1]) * 60;
        long s = Long.parseLong(hms[2]);
        return h+m+s;
    }
}
